package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.Saleman;

/**
 * 
 * @author XH
 *
 */
@Transactional(readOnly = true)
public interface SalemanRepository extends JpaRepository<Saleman, String> {

	/**
	 * 根据查询条件查询数据
	 * @param key
	 * @param pageable
	 * @return
	 */
	@Query(" select s from Saleman s where s.salemanName like '%'+?1+'%' or s.position like '%'+?1+'%' "
			+ "or s.contractPhone like '%'+?1+'%' or s.memo like '%'+?1+'%' order by s.createTime desc ")
    Page<Saleman> getSalemans(String key, Pageable pageable);
	
}
